<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAkbusPersonnelDepartureTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('akbus_personnel_departure', function (Blueprint $table) {
            $table->id();
            $table->date('departure_at')->nullable()->comment('离职时间');
            $table->text('departure_reason')->nullable()->comment('离职原因');

            $table->unsignedBigInteger('personnel_id')->comment('人员ID');
            $table->foreign('personnel_id')->references('id')->on('akbus_personnel')->onDelete('cascade');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('akbus_personnel_departure');
    }
}
